
<script>

$(document).ready(function() {
	 var types=new Array(<?php getAuthoringElements(); ?>);
	 //var elementType=$("#el_AUTHORINGELEMENTID").parent().find("select option:selected").text().toUpperCase();
	 var elementType=$("#ButterflyPortal_data_AUTHORINGELEMENTID").val().toUpperCase();
 //alert(elementType);
	    for (var i=0;i<types.length;i++)
	        {             

	   //     if ($("#x_authoringelementId").val()!=(i+1)) $("#el_"+types[i]+"VALUE").parent().parent().hide();
//  alert($("#el_"+types[i]+"VALUE"));
	        $("#el_"+types[i]+"VALUE").parent().parent().hide();   
	       
	        }
	    $("#el_"+elementType+"_<?=$LANG?>_VALUE").parent().parent().show();   
	     $("#el_"+elementType+"VALUE").parent().parent().show();
	//alert(elementType);
	    if (elementType!="FLASH"){
	        $("#el_FLASHWIDTHVALUE").parent().parent().hide();
	         $("#el_FLASHHEIGHTVALUE").parent().parent().hide();
	         $("#el_FLASHVARSVALUE").parent().parent().hide();
	         }

    $("#el_YOUTUBEVIDEOWIDTHVALUE").parent().parent().hide();
    $("#el_YOUTUBEVIDEOHEIGHTVALUE").parent().parent().hide();
    $("#el_").parent().parent().hide();
    $("#el_MAP_LATVALUE").parent().parent().hide();
    $("#el_MAP_LONGVALUE").parent().parent().hide();
    $("#el_IMAGEVALUE_EXT").parent().parent().hide();
    $("#el_IMAGE_ARVALUE_EXT").parent().parent().hide();
    $("#el_IMAGE_ARVALUE").parent().parent().hide();
if (elementType=="IMAGE" && "<?php echo $LANG; ?>"=="AR") $("#el_IMAGE_ARVALUE").parent().parent().show();

    if (elementType=="MAP") {
        $("#el_MAP_LONGVALUE").parent().parent().show();
        $("#el_MAP_LATVALUE").parent().parent().show();

    }

    if (elementType=="YOUTUBEVIDEO") {

        $("#el_YOUTUBEVIDEOWIDTHVALUE").parent().parent().show();
        $("#el_YOUTUBEVIDEOHEIGHTVALUE").parent().parent().show();

    }
	});

	
</script>

<?php 
if ($currentObject->authoringtemplate_elementid=="Query"){
$tmp=getObjByKey("portal_authoringtemplate_elements","VALUE","id",$currentObject->authoringtemplate_elementid);
//echo $tmp;
eval("\$sSql = \"$tmp\";" );

//echo $sSql;
?>
<select  title="" name="queryvalue" id="queryvalue" >
<option value="none"></option>
<?php

      $rs=$GLOBALS["conn"]->Execute($sSql); 
		
 while ( !$rs->EOF)  { 
 	
		  ?>
<option  <?php if ($currentObject->queryvalue==$rs->fields["VALUE"]) echo "Selected"; ?> value="<?php echo $rs->fields["VALUE"]; ?>"><?php echo $rs->fields["lib"]; ?></option>

				  <?php
		  $rs->MoveNext();    
		  }


	
?>
</select>

<script>
$("#x_QUERYVALUE").hide();
$("#queryvalue").change(function(){
$("#x_QUERYVALUE").val($(this).val());
		});


$("#el_QUERYVALUE").append($("#queryvalue"));

</script>
<?php } ?>

<?php

if ($currentObject->authoringtemplate_elementid=="Fichier"){

?>

<iframe src="/portlet.php?app=system&operation=formUpload&contentvaluesId=<?php echo $currentObject->id; ?>&contentId=<?php echo $currentObject->contentId; ?>&path=<?php echo ew_UploadPathEx(TRUE, $currentObject->filevalue); ?>" id="iframeupload" height="40px" width="100%" frameborder="0"></iframe>


 <script type="text/javascript" >

     function reload(id)
     {
       ///  alert("/portal/portal_contentedit.php?id="+id);
         window.location="/portal/portal_contentedit.php?id="+id;
     }
     $(document).ready(function() {
     $("#el_FILEVALUE").html($("#iframeupload"));
     $("#btnAction").remove();
     });

</script>

     <?php }
     
YamlifyCK("RICHTEXT_AR_VALUE");
//YamlifyType("any");

?>

<<script type="text/javascript">
<!--

//$("#ButterflyPortal_data_AUTHORINGTEMPLATE_ELEMENTID").attr("readonly","true");

//-->
//$.noConflict();
CKEDITOR.replace( 'RICHTEXT_EN_VALUE' );
</script>


<?php 


// Make sure you are using a correct path here.
//include_once 'ckeditor/ckeditor.php';

//$ckeditor = new CKEditor();
/*$ckeditor->basePath = '/ckeditor/';
$ckeditor->config['filebrowserBrowseUrl'] = '/ckfinder/ckfinder.html';
$ckeditor->config['filebrowserImageBrowseUrl'] = '/ckfinder/ckfinder.html?type=Images';
$ckeditor->config['filebrowserFlashBrowseUrl'] = '/ckfinder/ckfinder.html?type=Flash';
$ckeditor->config['filebrowserUploadUrl'] = '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files';
$ckeditor->config['filebrowserImageUploadUrl'] = '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images';
$ckeditor->config['filebrowserFlashUploadUrl'] = '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash';

*/
//$ckeditor->editor('RICHTEXT_EN_VALUE')

?>




